<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<body>
	<p:tabView id="tabView">
		<p:tab id="tab1" title="#{aqarMsgs.Aqarat_CalculatePayments_NumberOfPayments}">
			<h:form>
				<h:panelGrid columns="3">
					<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_SalePrice}" />
					<h:outputText value=":" />
					<p:inputText value="#{calculatePaymentsBean.salePrice}"
						converterMessage="#{aqarMsgs.Aqarat_CalculatePayments_SalePriceConverter}">
						<f:converter converterId="javax.faces.Double" />
					</p:inputText>

					<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_FirstPayment}" />
					<h:outputText value=":" />
					<p:inputText value="#{calculatePaymentsBean.firstPayment}"
						converterMessage="#{aqarMsgs.Aqarat_CalculatePayments_FirstPaymentConverter}">
						<f:converter converterId="javax.faces.Double" />
					</p:inputText>

					<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_PaymentValue}" />
					<h:outputText value=":" />
					<p:inputText value="#{calculatePaymentsBean.paymentValue}"
						converterMessage="#{aqarMsgs.Aqarat_CalculatePayments_PaymentValueConverter}">
						<f:converter converterId="javax.faces.Double" />
					</p:inputText>
				</h:panelGrid>
				<p:commandButton value="#{aqarMsgs.Aqarat_CalculatePayments_Calculate}"
					actionListener="#{calculatePaymentsBean.calculateNumberOfPayments}"
					update="result1 msgs" />
				<h:panelGroup id="result1">
					<h:panelGrid columns="3">
						<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_TotalNumberOfPayments}" />
						<h:outputText value=":" />
						<h:outputText value="#{calculatePaymentsBean.totalNoOfPayments}" />
					</h:panelGrid>
					<h:panelGrid columns="4"
						rendered="#{calculatePaymentsBean.remainingAmount !=null and calculatePaymentsBean.remainingAmount !=0}">
						<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_Number}" />
						<h:outputText value="#{calculatePaymentsBean.noOfPayments}" />
						<h:outputText value=" #{aqarMsgs.Aqarat_CalculatePayments_With} " />
						<h:outputText value="#{calculatePaymentsBean.paymentValue}"
							/>

						<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_Number}" />
						<h:outputText value=" 1 " />
						<h:outputText value=" #{aqarMsgs.Aqarat_CalculatePayments_With} " />
						<h:outputText value="#{calculatePaymentsBean.remainingAmount}" />
					</h:panelGrid>
				</h:panelGroup>
				<p:messages id="msgs" />
			</h:form>
		</p:tab>
		<p:tab id="tab2" title="#{aqarMsgs.Aqarat_CalculatePayments_PaymentValue}">
			<h:form>
				<h:panelGrid columns="3">
					<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_SalePrice}" />
					<h:outputText value=":" />
					<p:inputText value="#{calculatePaymentsBean.salePrice}"
						converterMessage="#{aqarMsgs.Aqarat_CalculatePayments_SalePriceConverter}">
						<f:converter converterId="javax.faces.Number" />
					</p:inputText>

					<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_FirstPayment}" />
					<h:outputText value=":" />
					<p:inputText value="#{calculatePaymentsBean.firstPayment}"
						converterMessage="#{aqarMsgs.Aqarat_CalculatePayments_FirstPaymentConverter}">
						<f:converter converterId="javax.faces.Number" />
					</p:inputText>

					<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_NumberOfPayments}" />
					<h:outputText value=":" />
					<p:inputText value="#{calculatePaymentsBean.noOfPayments}"
						converterMessage="#{aqarMsgs.Aqarat_CalculatePayments_NumberOfPaymentsConverter}">
						<f:converter converterId="javax.faces.Long" />
					</p:inputText>
				</h:panelGrid>
				<p:commandButton value="#{aqarMsgs.Aqarat_CalculatePayments_Calculate}"
					actionListener="#{calculatePaymentsBean.calculatePaymentValue}"
					update="result2 msgss" />
				<h:panelGrid id="result2" columns="3">
					<h:outputText value="#{aqarMsgs.Aqarat_CalculatePayments_PaymentValue}" />
					<h:outputText value=":" />
					<h:outputText value="#{calculatePaymentsBean.paymentValue}" />

				</h:panelGrid>
				<p:messages id="msgss" />
			</h:form>
		</p:tab>

	</p:tabView>
</body>
</html>
